package com.ruihu.admin.module.business.tasknode.domain.vo;

import com.ruihu.admin.module.business.tasknode.domain.dto.TaskNodeDTO;
import com.ruihu.admin.module.business.tasknode.domain.entity.TaskNodeEntity;
import lombok.Data;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;

/**
 *  [ 任务环节 ]
 *
 * @author Tony
 * @version 1.0
 * @company 瑞虎（南京）信息技术有限公司
 * @copyright (c) 瑞虎（南京）信息技术有限公司Inc. All rights reserved.
 * @date  2022-08-30 17:07:35
 * @since JDK1.8
 */
@Data
public class TaskNodeVO {
    @ApiModelProperty("主键")
    private Long id;

    @ApiModelProperty("节点名称")
    private String nodeName;

    @ApiModelProperty("节点描述")
    private String nodeDesc;

    @ApiModelProperty("序号")
    private Integer sortNo;

    @ApiModelProperty("创建人")
    private String createByName;

    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty("更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    public static TaskNodeVO convertToTaskNodeVO(TaskNodeDTO taskNodeDTO) {
        if (taskNodeDTO == null) {
            return null;
        }
        TaskNodeVO taskNodeVO = new TaskNodeVO();
        taskNodeVO.setNodeName(taskNodeDTO.getNodeName());
        taskNodeVO.setNodeDesc(taskNodeDTO.getNodeDesc());
        taskNodeVO.setSortNo(taskNodeDTO.getSortNo());
        taskNodeVO.setId(taskNodeDTO.getId());
        taskNodeVO.setUpdateTime(taskNodeDTO.getUpdateTime());
        taskNodeVO.setCreateTime(taskNodeDTO.getCreateTime());
        taskNodeVO.setCreateByName(taskNodeDTO.getCreateByName());
        return taskNodeVO;
    }

    public static TaskNodeVO convertToTaskNodeVO(TaskNodeEntity taskNodeEntity) {
        if (taskNodeEntity == null) {
            return null;
        }
        TaskNodeVO taskNodeVO = new TaskNodeVO();
        taskNodeVO.setNodeName(taskNodeEntity.getNodeName());
        taskNodeVO.setNodeDesc(taskNodeEntity.getNodeDesc());
        taskNodeVO.setSortNo(taskNodeEntity.getSortNo());
        taskNodeVO.setId(taskNodeEntity.getId());
        taskNodeVO.setUpdateTime(taskNodeEntity.getUpdateTime());
        taskNodeVO.setCreateTime(taskNodeEntity.getCreateTime());
        return taskNodeVO;
    }

}
